From: Florian Müllner Date: Tue, 13 Jun 2017 02:56:34 +0000 (+0200) Subject: history: Fix bogus return value X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~267 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=b50d7143d11e0fd8a4d29acbea3d4750956aa4e5;p=gnome-shell.git history: Fix bogus return value We only use lastItem() to reset the history index to the end, so nobody noticed the utter nonsense in the return value until gjs started to warn about it. As we don't actually use the value anywhere, we could just remove it, but the function name implies that an item is returned, so fix it to behave as advertised. https://bugzilla.gnome.org/show_bug.cgi?id=781471 --- diff --git a/js/misc/history.js b/js/misc/history.js index b56d83064..44d21b7d6 100644 --- a/js/misc/history.js +++ b/js/misc/history.js @@ -69,7 +69,7 @@ const HistoryManager = new Lang.Class({ this._indexChanged(); } - return this._historyIndex[this._history.length]; + return this._historyIndex ? this._history[this._historyIndex -1] : null; }, addItem: function(input) {